import http from "@/utils/request";

/**
 * 获取所有班级
 * @returns
 */
export function getAllClasses() {
  return http.get('/classes');
}

/**
 * 根据id获取班级
 * @param {Number} id
 * @returns
 */
export function getClass(id) {
  return http.get(`/classes/${id}`);
}


/*
-------------------
管理员接口
-------------------
*/

/**
 * 创建班级
 * @param {String} name
 * @param {String} description
 * @returns
 */
export function createClass(name, description) {
  return http.post('/classes', { name, description });
}

/**
 *
 * @param {Number} id
 * @param {String} name
 * @param {String} description
 * @returns
 */
export function updateClass(id, name, description) {
  return http.put(`/classes/${id}`, { name, description });
}

/**
 *
 * @param {Number} id
 * @returns
 */
export function delClass(id) {
  return http.delete(`/classes/${id}`);
}
